<template>
  <header class="bar bar-nav bar-easy-vue">
    <a class="icon icon-refresh pull-left" v-if="showRefeshIcon" @click="refresh"></a>
    <a class="icon icon-left-nav pull-left" v-if="showReturnIcon" @click="goBack"></a>
    <a class="icon icon-compose pull-right" v-if="showLogoutIcon" @click="logout">登出</a>
    <span class="headr_title">{{ this.$store.state.headerTitle }}</span>
  </header>
</template>

<script>
export default {
  props: {
    showRefeshIcon: {
      default: false
    },
    showReturnIcon: {
      default: true
    },
    showLogoutIcon: {
      default: true
    },
  },
  methods:{
    logout: function() {
        sessionStorage.removeItem("tltd_loginName");
        sessionStorage.removeItem("tltd_token");
        sessionStorage.removeItem("tltd_loginType");
        sessionStorage.removeItem("tltd_openid");
        sessionStorage.removeItem("tltd_brhId");
        localStorage.setItem("logoutVal", "1");
        location.href = LoginInit_URL;
    },
    refresh: function() {
/*      this.$store.dispatch('getData', {
        progress: this,
        refresh: true
      });*/
    },
    goBack: function() {

      this.$router.back();
      this.$store.state.showLoading = false;
    }
  }
}
</script>

<style  lang='scss' scoped>
header{
    position: fixed;
    top:0;
    line-height: 21px;
    background-color: #2792e4;
    text-align: center;
    color: #fff;
    font-size: 18px;
    width: 100%;
    font-family: medium;
    padding: 10px 0;
    z-index: 99;
    .headr_title{
        margin-left: -24px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        width: 70%;
        display: inline-block;
    }
}

.icon-left-nav{
    display: inline-block;
    width: 24px;
    height: 24px;
    float: left;
    margin-left: 10px;
    line-height: 24px;
    text-align: center;
    background-image:url("/FuLiBao/tltd/Lenovo/static/images/fanhui.png");
    background-repeat: no-repeat;
    background-size: 24px 24px;
}
.pull-right{
    float: right;
    margin-right: 10px;
}
</style>
